<?php
$pageTitle = __('Browse Items');
echo head(array('title'=>$pageTitle,'bodyclass' => 'items browse'));
?>

<?php echo item_search_filters(); ?>

<h1><?php echo $pageTitle;?> <?php echo __('(%s total)', $total_results); ?></h1>

<?php echo pagination_links(); ?>

<?php if ($total_results > 0): ?>

<?php
$sortLinks[__('Title')] = 'Dublin Core,Title';
$sortLinks[__('Creator')] = 'Dublin Core,Creator';
$sortLinks[__('Date Added')] = 'added';
?>
<div id="sort-links">
    <span class="sort-label"><?php echo __('Sort by: '); ?></span><?php echo browse_sort_links($sortLinks); ?>
</div>

<?php endif; ?>

<?php foreach (loop('items') as $item): ?>
<div class="item hentry">

    <h2>
    <?php
    //$itemTitle=array();
    $longDesc = metadata('item', array('Dublin Core', 'Description'), array('snippet'=>600));
    echo link_to_item(metadata(
      'item', array('Dublin Core', 'Title')),
      array('class'=>'tooltip','title'=>$longDesc)
      );
    ?>
    </h2>

    <div class="item-meta">
    <?php if (metadata('item', 'has thumbnail')): ?>
    <div class="item-img">
        <?php echo link_to_item(item_image('square_thumbnail')); ?>
    </div>
    <?php endif; ?>

    <?php if ($description = metadata('item', array('Dublin Core', 'Description'), array('snippet'=>250))): ?>
    <div class="item-description">
        <?php echo $description; ?>
    </div>
    <?php endif; ?>

    <?php
    $collection = metadata('item', array('Dublin Core', 'Subject'));
    if (!empty($collection)): ?>
    <div class="collection">
    	Sujet :
        <?php echo $collection; ?>
    </div>
    <?php endif; ?>

    <?php if (metadata('item', 'has tags')): ?>
    <div class="tags">
    	<?php echo __('Tags'); ?> :
        <?php echo tag_string('items'); ?>
    </div>
    <?php endif; ?>

    <?php
    $collection = link_to_collection_for_item();
    if (!empty($collection)): ?>
    <div class="collection">
    	Collection :
        <?php echo $collection; ?>
    </div>
    <?php endif; ?>

    <?php fire_plugin_hook('public_items_browse_each', array('view' => $this, 'item' =>$item)); ?>

    </div><!-- end class="item-meta" -->
</div><!-- end class="item hentry" -->
<?php endforeach; ?>

<?php echo pagination_links(); ?>

<div id="outputs">
    <p id="outputs-label"><?php echo __('Output Formats'); ?> :</p>
    <?php echo output_format_list(false); ?>
</div>

<?php fire_plugin_hook('public_items_browse', array('items'=>$items, 'view' => $this)); ?>

<?php echo foot(); ?>
